﻿using System;

namespace Unity.Commons.Client.Threading
{
    public class ResourceTask : IResourceTask
    {
        private readonly Func<bool> _command;
        private readonly Func<bool> _condition;

        public ResourceTask(Func<bool> command, Func<bool> condition)
        {
            _command = command;
            _condition = condition;
        }

        public bool IsNeedRun()
        {
            return _condition();
        }

        public bool Run()
        {
            return _command();
        }

    }
}
